﻿

using ConfClient;
using System.Collections.Generic;
using System.Text;
using UtilLib;

public static partial class Zsc
{
    public static string GenderSelf(string sex)
    {
        return "你";
    }
    public static string GenderSelf(EGender sex)
    {
        return "你";
    }
    public static string GenderPronoun(string sex)
    {
        return sex switch
        {
            "男性" => "他",
            "女性" => "她",
            _ => "它",
        };
    }
    public static string GenderPronoun(EGender sex) => GenderPronoun(sex.ToString());
    public static string QueryRude(int age, string gender, EClasss classs)
    {
        if (gender == "女性")
        {
            switch (classs)
            {
                case EClasss.仙:
                    return true switch
                    {
                        _ when age < 30 => "小妖精",
                        _ when age < 50 => "妖女",
                        _ => "老妖婆"
                    };
                case EClasss.妖魔:
                    return true switch
                    {
                        _ when age < 30 => "小妖女",
                        _ when age < 50 => "妖女",
                        _ => "老妖婆"
                    };
                case EClasss.神:
                    return true switch
                    {
                        _ when age < 30 => "小妖女",
                        _ when age < 50 => "妖女",
                        _ => "老妖婆"
                    };
                case EClasss.僧:
                    return true switch
                    {
                        _ when age < 30 => "小贼尼",
                        _ when age < 50 => "贼尼",
                        _ => "老贼尼"
                    };
                case EClasss.道:
                    return true switch
                    {
                        _ when age < 30 => "小妖女",
                        _ when age < 50 => "妖女",
                        _ => "老妖婆"
                    };
                default:
                    return true switch
                    {
                        _ when age < 30 => "小贱人",
                        _ when age < 50 => "贱人",
                        _ => "死老太婆"
                    };
            }
        }
        else
        {
            switch (classs)
            {
                case EClasss.仙:
                    return true switch
                    {
                        _ when age < 50 => "死妖怪",
                        _ => "老妖怪"
                    };
                case EClasss.妖魔:
                    return true switch
                    {
                        _ when age < 50 => "死妖怪",
                        _ => "老妖怪"
                    };
                case EClasss.神:
                    return "死牛鼻子";
                case EClasss.僧:
                    return true switch
                    {
                        _ when age < 50 => "死秃驴",
                        _ => "老秃驴"
                    };
                case EClasss.道:
                    return "死牛鼻子";
                case EClasss.儒:
                    return true switch
                    {
                        _ when age < 18 => "小书呆子",
                        _ when age < 50 => "臭书呆子",
                        _ => "老童生"
                    };
                default:
                    return true switch
                    {
                        _ when age < 30 => "小王八蛋",
                        _ when age < 50 => "臭贼",
                        _ => "老匹夫"
                    };
            }
        }
    }


    public static string[] ListChDigit = { "零", "十", "百", "千", "万", "亿", "兆" };
    public static string[] ListChNum = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十" };
    public static string[] ListChTien = { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };
    public static string[] ListChDee = { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };
    /// <summary>
    /// 中文数字 ChineseNumber
    /// </summary>
    /// <returns></returns>
    public static string ChineseNumber(long i)
    {
        if (i < 0) return "负" + ChineseNumber(-i);
        if (i < 11) return ListChNum[i];
        if (i < 20) return ListChNum[10] + ListChNum[i - 10];
        if (i < 100)
        {
            if (i % 10 == 0) return ListChNum[i / 10] + ListChDigit[1];
            else return ListChNum[i / 10] + ListChDigit[1] + ListChNum[i % 10];
        }
        if (i < 1000)
        {
            if (i % 100 == 0)
                return ListChNum[i / 100] + ListChDigit[2];
            else if (i % 100 < 10)
                return ListChNum[i / 100] + ListChDigit[2] + ListChNum[0] + ChineseNumber(i % 100);
            else if (i % 100 < 20)
                return ListChNum[i / 100] + ListChDigit[2] + ListChNum[1] + ChineseNumber(i % 100);
            else return ListChNum[i / 100] + ListChDigit[2] + ChineseNumber(i % 100);
        }
        if (i < 10000)
        {
            if (i % 1000 == 0)
                return ListChNum[i / 1000] + ListChDigit[3];
            else if (i % 1000 < 100)
                return ListChNum[i / 1000] + ListChDigit[3] + ListChDigit[0] + ChineseNumber(i % 1000);
            else
                return ListChNum[i / 1000] + ListChDigit[3] + ChineseNumber(i % 1000);
        }
        if (i < 100000000)
        {
            if (i % 10000 == 0)
                return ChineseNumber(i / 10000) + ListChDigit[4];
            else if (i % 10000 < 1000)
                return ChineseNumber(i / 10000) + ListChDigit[4] + ListChDigit[0] + ChineseNumber(i % 10000);
            else
                return ChineseNumber(i / 10000) + ListChDigit[4] + ChineseNumber(i % 10000);
        }
        if (i < 1000000000000)
        {
            if (i % 100000000 == 0)
                return ChineseNumber(i / 100000000) + ListChDigit[5];
            else if (i % 100000000 < 10000000)
                return ChineseNumber(i / 100000000) + ListChDigit[5] + ListChDigit[0] + ChineseNumber(i % 100000000);
            else
                return ChineseNumber(i / 100000000) + ListChDigit[5] + ChineseNumber(i % 100000000);
        }
        if (i % 1000000000000 == 0)
            return ChineseNumber(i / 1000000000000) + ListChDigit[6];
        else if (i % 1000000000000 < 100000000000)
            return ChineseNumber(i / 1000000000000) + ListChDigit[6] + ListChDigit[0] + ChineseNumber(i % 1000000000000);
        else
            return ChineseNumber(i / 1000000000000) + ListChDigit[6] + ChineseNumber(i % 1000000000000);
    }
    public const long BvalueSilver = 100;
    public const long BvalueGold = 10000;
    /// <summary>
    /// 中文钱 ChineseMoney
    /// </summary>
    /// <returns></returns>
    public static string ChineseMoney(long i)
    {
        StringBuilder sb = new StringBuilder();
        long sum = System.Math.Max(i, 0);
        var gamount = sum / BvalueGold;
        var samount = (sum - (gamount * BvalueGold)) / BvalueSilver;
        var camount = sum % BvalueSilver;
        if (gamount >= 1)
        {
            sb.Append($"{ChineseNumber(gamount)}两#HIY#黄金#NOR#");
        }
        if (samount >= 1)
        {
            sb.Append($"{ChineseNumber(samount)}两#WHT#白银#NOR#");
        }
        sb.Append($"{ChineseNumber(camount)}文#YEL#铜板#NOR#");
        return sb.ToString();
    }
    /// <summary>
    /// 方向中文
    /// </summary>
    /// <param name="en"></param>
    /// <returns></returns>
    public static string ChineseDir(string en)
    {
        return en switch
        {
            "e" => "东",
            "s" => "南",
            "w" => "西",
            "n" => "北",
            "se" => "东南",
            "ne" => "东北",
            "nw" => "西北",
            "sw" => "西南",
            _ => "中",
        };
    }
    /// <summary>
    /// 反方向
    /// </summary>
    /// <param name="exit"></param>
    /// <returns></returns>
    public static string OppExit(this string exit)
    {
        return exit switch
        {
            "e" => "w",
            "s" => "n",
            "w" => "e",
            "n" => "s",
            "se" => "nw",
            "ne" => "sw",
            "nw" => "se",
            "sw" => "ne",
            _ => "c",
        };
    }

}
